package com.monitor.service.factory;

import com.monitor.service.report.HtmlReportGenerator;
import com.monitor.service.report.PDFReportGenerator;
import com.monitor.service.report.ReportGenerator;
import com.monitor.service.report.TextReportGenerator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * 报告生成器工厂
 * 工厂模式：创建不同类型的报告生成器
 */
public class ReportGeneratorFactory {
    private static final Logger logger = LoggerFactory.getLogger(ReportGeneratorFactory.class);
    
    /**
     * 根据报告类型创建对应的生成器
     * @param reportType 报告类型：text, html, pdf
     * @return 报告生成器实例
     */
    public static ReportGenerator createReportGenerator(String reportType) {
        switch (reportType.toLowerCase()) {
            case "text":
                return new TextReportGenerator();
            case "html":
                return new HtmlReportGenerator();
            case "pdf":
                return new PDFReportGenerator();
            default:
                logger.warn("未知的报告类型: {}，将使用文本报告", reportType);
                return new TextReportGenerator();
        }
    }
} 